<?php
/**
 * @Name: RoleLogic.php
 * @Author: yashuai<1762910894@qq.com>
 */

namespace app\common\logic\rbac;

use app\common\logic\BaseCurdLogic;
use app\common\model\rbac\RoleModel;
use HugCode\PhpUnits\Frame\Code\ConstCode;

class RoleLogic extends BaseCurdLogic
{

    /**
     * @Desc 设置模型
     * @return string
     * @author yashuai<1762910894@qq.com>
     */
    protected function setModel(): string
    {
        return RoleModel::class;
    }

    /**
     * @Desc 数据转为表结构数据
     * @param array $params
     * @param string|null $type
     * @param array|null $row
     * @return array
     * @author yashuai<1762910894@qq.com>
     */
    protected function getParamsTableData(array $params = [], ?string $type = '', ?array $row = []): array
    {
        $data = _params_isset_table_data(['RoleName', 'RoleDesc', 'RoleStatus'], $params);
        if (!isset($data['RoleStatus'])) {
            $data['RoleStatus'] = ConstCode::BASIC_STATUS_NORMAL;
        }
        return $data;
    }

}
